package com.bc;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;

public class EnterKeyPopup extends Activity {
	
	
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.enterkeypopuplayout);
		
		//Location
		TextView loc = (TextView)findViewById(R.id.TextView02enterkeypopup);
		BCReceiver rec = new BCReceiver();
		String s = rec.getLocation();
		if(s==null)s="Location unavailable";
		loc.setText(s);
		
		
		Button valid = (Button)findViewById(R.id.validatekeybutton);
		valid.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				EditText in = (EditText)findViewById(R.id.KeyInput);
				String key = in.getText().toString();
				BCApp.client.setKey(key);
				BCApp.client.setCreating(false);
				setResult(RESULT_OK);
				EnterKeyPopup.this.finish();
			}
		});
		
		Button cancel = (Button)findViewById(R.id.Enterkeycancelbutton);
		cancel.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				setResult(RESULT_CANCELED);
				EnterKeyPopup.this.finish();
			}
		});
	}

}
